<template>
  <div>
    <el-row :gutter="20">
      <el-col :xs="24" :sm="12" :md="8" :lg="6" v-for="(blog, index) in blogList" :key="index">
        <el-card shadow="hover">
          <img :src="blog.image" class="blog-image" />
          <div class="blog-info">
            <h3>{{ blog.title }}</h3>
            <p>{{ blog.userName }}</p>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'BlogIndex',

  data() {
    return {
      blogList: [
        {
          image: 'https://via.placeholder.com/150',
          title: '博客标题1',
          userName: '用户1'
        },
        {
          image: 'https://via.placeholder.com/150',
          title: '博客标题2',
          userName: '用户2'
        },
        {
          image: 'https://via.placeholder.com/150',
          title: '博客标题3',
          userName: '用户3'
        },
        {
          image: 'https://via.placeholder.com/150',
          title: '博客标题4',
          userName: '用户4'
        }
      ]
    };
  },

  created() {
    // 这里可以添加初始化数据的逻辑
  }
};
</script>

<style scoped>
.blog-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.blog-info {
  padding: 10px;
}

.blog-info h3 {
  margin: 0;
  font-size: 18px;
}

.blog-info p {
  margin: 5px 0 0;
  font-size: 14px;
  color: #606266;
}
</style>